/**
 * 
 */
package com.wubo.sec.util;

import java.lang.reflect.Array;


/**
 * @author wubo
 * @CreateDate 2010-8-2
 * @version 1.0.01
 */
public abstract class ArrayUtils {
	
	public static <T> String split(T arrayObj, String split){
		return split(arrayObj, split, "");
	}

	public static <T> String split(T arrayObj, String split, String quoteStr){
		if(arrayObj == null)return null;
		
		if(! arrayObj.getClass().isArray()){
			throw new IllegalArgumentException("The first param must be an array");
		}
		
		StringBuffer sb = new StringBuffer();
		for(int i=0; i<Array.getLength(arrayObj); i++){
			if(i>0){
				sb.append(split);
			}
			sb.append(quoteStr);
			sb.append(Array.get(arrayObj, i));
			sb.append(quoteStr);
		}
		return sb.toString();
	}
	
	
	
	public static void main(String[] args){
		long[] array = new long[]{1l,2l,3l};
		System.out.println(split(array, ",", "'"));
	}
}
